{% extends "../docshell.html" %}
{% block title %}Code layout{% endblock %}
{% block navigation %}{% include 'navigation.html' %}{% endblock %}
{% block content %}
<h1>Code layout</h1>

<h2>Contents</h2>
<ul class="page_toc">
  <li><a href="#layout">Codebase directories</a></li>
  <li><a href="#jslibrary">Library structure</a></li>
  <li><a href="#samples">Samples</a></li>
  <li><a href="#showcase">Showcase Apps</a></li>
  <li><a href="#gwtlibrary">GWT Package structure</a></li>
  <li><a href="#gwtshowcase">GWT Showcase App</a></li>
</ul>

<a name="layout"><h2>Codebase directories</h2></a>
<p>The Rhizosphere codebase is structured in the following directories:</p>
<dl>
  <dt><code>appengine</code></dt>
  <dd>
    <p>
      Appengine application to serve the Rhizosphere library. Also hosts
      the documentation and everything you see in the Rhizosphere
      <a href="http://www.rhizospherejs.com">demo site</a>.
    </p>

    <p>
      Two further subdirectories exist: <code>src/</code> contains the
      application source code, <code>shared/</code> contains shared, third-party
      libraries required by it.
    </p>

    <p>
      The <code>src/</code> directory is further subdivided into these ones:
    </p>
    <ul>
      <li><code>src/py/handlers</code>: Request handlers that serve web
          requests.</li>
      <li><code>src/py/models</code>: Model objects used by handlers.</li>
      <li><code>src/static</code>: Static resources, such as images, javascript
          bundles and stylesheets. Most of the subdirectories are symlinks
          to the other directories listed here (such as <code>lib/</code>)</li>
      <li><code>src/templates</code>: page templates (includes Rhizosphere
          documentation in <code>src/templates/doc</code>).</li>
    </ul>
  </dd>

  <dt><code>lib</code></dt>
  <dd>
    Pre-packaged, minified versions of the Rhizosphere library ready for
    production deployment.
  </dd>

  <dt><code>src</code></dt>
  <dd>
    Rhizosphere source code. The bulk of the library is contained within
    <code>src/js</code>. The <code>src/js/extra</code> dir contains
    extra Rhizosphere functionality that may be omitted when packaging
    Rhizosphere for deployment.
  </dd>

  <dt><code>samples</code></dt>
  <dd>
    Source code for Rhizosphere demos with sample datasets. Each sample
    illustrate a basic aspect of Rhizosphere, or uses simplified datasets
    to keep the demo easy to understand.
   </dd>

  <dt><code>showcase</code></dt>
  <dd>
    Source code for Rhizosphere showcase applications. Showcase apps are more
    complex that samples and demonstrate complete applications that leverage
    multiple Rhizosphere capabilities.
  </dd>

  <dt><code>gwt</code></dt>
  <dd>
    Source code for Rhizosphere GWT module. It is further subdivided in
    <code>gwt/src</code>, the actual source code, <code>gwt/build</code>, Apache
    Ant build files, <code>gwt/lib</code>, output directory for packaged
    versions of the Rhizosphere GWT module, and <code>gwt/javadoc</code>,
    Javadoc documentation.
  </dd>

  <dt><code>gwtshowcase</code></dt>
  <dd>
    Demo application that shows various samples of Rhizosphere integration
    within a GWT app. It is further subdivided in <code>gwtshowcase/src</code>,
    the actual source code, <code>gwt/war</code>, static files and deployment
    descriptors for the sample application, <code>gwtshowcase/build</code>,
    Apache Ant build files, and <code>gwt/lib</code>, output directory for
    packaged (.war format) versions of the Rhizosphere GWT sample.
  </dd>
</dl>

<a name="jslibrary"><h2>Library structure</h2></a>
<p>Rhizosphere code is structured as a set of interconnected modules.
  Each module provides a specific functionality, lives in a separate source
  file and may depend on other modules.
</p>
<p>When Rhizosphere is packaged for production deployment, all module
  dependencies are resolved and all modules are packaged in a single javascript
  file.
</p>
<p>The main modules are listed here. The
  <a href="http://code.google.com/p/rhizosphere/source/browse/#hg/src/js">
    source code</a> remains the ultimate reference you should rely on for
    completeness.
</p>
<dl>
  <dt>rhizo</dt>
  <dd>
    Shared utilities.
  </dd>

  <dt>rhizo.log</dt>
  <dd>Logging facilities.</dd>

  <dt>rhizo.jquery</dt>
  <dd>Extensions to the jQuery library.</dd>

  <dt>rhizo.base</dt>
  <dd>
    Core library functionality. Defines what a Rhizosphere visualization is
    and ties all other modules together.
  </dd>

  <dt>rhizo.state</dt>
  <dd>Visualization state management (includes HTML5 History support).</dd>

  <dt>rhizo.model</dt>
  <dd>Defines the behaviour and characteristics of Rhizosphere models. A model
    represent a single datapoint in a visualization.
  </dd>

  <dt>rhizo.bootstrap</dt>
  <dd>Bootstrap logic. Defines the entry points to intialize a new Rhizosphere
    visualization.
  </dd>

  <dt>rhizo.model.loader</dt>
  <dd>Pluggable datasource loaders, that let Rhizosphere build its datamodel
    from datasources of your choice.
  </dd>

  <dt>rhizo.layout, rhizo.laoyut.shared, rhizo.layout.tree, rhizo.layout.treemap</dt>
  <dd>Layout algorithms.</dd>

  <dt>rhizo.meta, rhizo.meta.extra</dt>
  <dd>Defines the behaviour and characteristics of Rhizosphere metamodels. A
    metamodel defines the attributes and types that each model has, and
    therefore dictates the kind of filtering and clustering operations that
    such will be available in the visualization.
  </dd>

  <dt>rhizo.ui</dt>
  <dd>Defines the behaviour and characteristics of Rhizosphere renderings. A
    rendering is a visual representation of a model. It is the actual object
    that the user sees on screen to represent a single datapoint.
  </dd>

  <dt>rhizo.ui.gui</dt>
  <dd>Functionality to manage the Rhizosphere overall UI and chrome.</dd>

  <dt>rhizo.ui.component</dt>
  <dd>Defines the set of UI components that can be assembled together to form
    the complete Rhizosphere visualization.
  </dd>

  <dt>rhizo.autorender</dt>
  <dd>Provides an automated rendering of Rhizosphere models, for visualizations
    that are not given a custom renderer.
  </dd>

  <dt>rhizo.gviz</dt>
  <dd>
    Allows Rhizosphere to ingest data from Google Visualization API datasources.
  </dd>

  <dt>rhizo.broadcast</dt>
  <dd>
    Visualization broadcasting support. Allows users to broadcast live
    Rhizosphere visualizations and have multiple attendants follow them.
  </dd>

  <dt>rhizo.keyboard</dt>
  <dd>On-screen keyboard (for keyboard-less touchscreens).</dd>

</dl>

<a name="samples"><h2>Samples</h2></a>
<p>
  Rhizosphere ships with a number of samples and demo visualizations, located
  in the
  <a href="http://code.google.com/p/rhizosphere/source/browse/#hg/samples/js">
    <code>samples/js</code></a> directory.
</p>
<p class="note">
  <strong>Note</strong>. In addition to the included samples, Rhizosphere can
  also ingest any (reasonably formatted) Google Spreadsheet. See the
  <a href="/doc/users_spreadsheets.html">Use with Google Spreadsheets</a> section for
  more info.
</p>
<dl>
  <dt>people.js</dt>
  <dd>The most basic example, representing a fictional grouping of people.
    Defines a handful of attributes and let's you explore all basic layout
    algorithms.</dd>

  <dt>picasa.js</dt>
  <dd>Photo-browsing demo.</dd>

  <dt>books.js</dt>
  <dd>Shopping demo.</dd>

  <dt>usa.js</dt>
  <dd>shows the USA states and major cities.
    Demonstrates endless panning and the tree layout.</dd>

  <dt>factbook.js</dt>
  <dd>A selection of data from the CIA Factbook. Demonstrates Treemapping
    capabilities and logarithmic sliders.</dd>

  <dt>many.js</dt>
  <dd>A stress test to verify Rhizosphere capabilities in handling hundreds
    or thousands of elements. Can customize the number of elements to
    create via URL parameter.</dd>

  <dt>autorender.js</dt>
  <dd>
    Explains the AutoRenderer capabilities, automated legend and color coding.
  </dd>
</dl>

<a name="showcase"><h2>Showcase Apps</h2></a>
<p>
  Rhizosphere includes some showcase applications to demonstrate the library
  capabilities in more complex cases that the samples described above.
  These are complete applications that leverage multiple Rhizosphere
  capabilities for their purpose.
</p>
<p>
  All Showcase applications live in these directories:
  <a href="http://code.google.com/p/rhizosphere/source/browse/#hg/showcase">
    <code>showcase/</code></a> and
  <a href=""></a>
</p>
<ul>
  <li>
    <a href="http://code.google.com/p/rhizosphere/source/browse/#hg/showcase">
    <code>showcase/</code></a>: static resources (images, javascript, styles)
  </li>
  <li>
    <a href="http://code.google.com/p/rhizosphere/source/browse/#hg/appengine/src/py/handlers/showcase">
      <code>appengine/src/py/handlers/showcase</code></a>: web request handlers</li>
  <li>
    <a href="http://code.google.com/p/rhizosphere/source/browse/#hg/appengine/src/templates/showcase">
      <code>appengine/src/templates/showcase</code></a>: page templates.</li>
</ul>
<dl>
  <dt>Google Code Hosting</dt>
  <dd>
    A card-based agile project management tool built with Rhizosphere, capable of
    loading data from Google Code Hosting projects. You can also access it at
    <a href="http://codetracker.rhizospherejs.com">
      http://codetracker.rhizospherejs.com</a>
  </dd>
</dl>

<a name="gwtlibrary"><h2>GWT Package structure</h2></a>
<p>
  Refer to the <a href="/gwt/javadoc/index.html">Javadocs</a> for an overview
  of the package structure of the Rhizosphere GWT module.
</p>

<a name="gwtshowcase"><h2>GWT Showcase App</h2></a>
<p>
  Rhizosphere GWT Demo application is divided into 3 main packages, each one
  demonstrating a specific aspect of the library.
</p>
<dl>
  <dt><code>com.rhizospherejs.gwt.showcase.client.orgchart</code></dt>
  <dd>
    Demonstrates how to define Rhizosphere models and metamodels via
    annotated POJOs. Demonstrates how to define a renderer that emits
    raw HTML strings.
  </dd>
  <dt><code>com.rhizospherejs.gwt.showcase.client.books</code></dt>
  <dd>
    Demonstrates how to define Rhizosphere models and metamodels from
    a remote JSON feed. Demonstrates how to define a renderer that emits
    GWT Widgets.
  </dd>
  <dt><code>com.rhizospherejs.gwt.showcase.client.gviz</code></dt>
  <dd>
    Demonstrates how to use Rhizosphere as a visualization conforming to the
    Google Visualization APIs for GWT. Demonstrates how to define a renderer
    that emits GWT Widgets built using UiBinder templates.
  </dd>
</dl>
<p>
  A small number of other classes and packages exist for accessory functions,
  like resource handling and the intro page.
</p>
{% endblock %}